package com.xiaochong.tir.manager.service;

import com.xiaochong.tir.manager.config.druid.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaochong.tir.common.data.mapper.NonListedCompanyIndexMapper;
import com.xiaochong.tir.common.data.po.NonListedCompanyIndex;
import org.springframework.transaction.annotation.Transactional;

@Service
public class NonListedCompanyIndexService {

	@Autowired
	private NonListedCompanyIndexMapper nonListedCompanyIndexMapper;

	public PageInfo<NonListedCompanyIndex> findList(NonListedCompanyIndex nonListedCompanyIndex, int page, int limit) {
		PageHelper.startPage(page, limit);
		return new PageInfo<NonListedCompanyIndex>(nonListedCompanyIndexMapper.findList(nonListedCompanyIndex));
	}
	
	@Operation
	@Transactional
	public int  updateEnableFlag(NonListedCompanyIndex nonListedCompanyIndex,NonListedCompanyIndex old){
		return nonListedCompanyIndexMapper.updateByPrimaryKey(nonListedCompanyIndex);
	}
	@Operation
	@Transactional
	public int addNonListedCompanyIndex(NonListedCompanyIndex nonListedCompanyIndex){
		return nonListedCompanyIndexMapper.insertSelective(nonListedCompanyIndex);
	}
	
	public NonListedCompanyIndex getNonListedCompanyIndex(Integer id){
		return nonListedCompanyIndexMapper.selectByPrimaryKey(id);
	}
	@Operation
	@Transactional
	public int updateNonListedCompanyIndex(NonListedCompanyIndex nonListedCompanyIndex,NonListedCompanyIndex old){
		return nonListedCompanyIndexMapper.updateByPrimaryKey(nonListedCompanyIndex);
	}


	public NonListedCompanyIndex selectByPrimaryKey(Integer id) {
		return nonListedCompanyIndexMapper.selectByPrimaryKey(id);
	}

	/**
	 * 根据条件查询单条记录
	 * @param entity
	 */
	public NonListedCompanyIndex selectByEntity(NonListedCompanyIndex entity) {
		return this.nonListedCompanyIndexMapper.selectByEntity(entity);
	}
}
